<?php
        // 你只需要修改这个地方的地址就可以了
        $url = ('https://v.douyin.com/WuRMPV/');
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        // 不需要页面内容
        curl_setopt($ch, CURLOPT_NOBODY, 1);
        // 不直接输出
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        // 返回最后的Location
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_exec($ch);
        $info = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
        curl_close($ch);
        // 重定向地址
        $url = 'https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='.(explode('/',$info)[5]);
        $ch = curl_init($url); //初始化
        curl_setopt($ch, CURLOPT_HEADER, 0); // 不返回header部分
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回字符串，而非直接输出
        curl_setopt($ch, CURLOPT_USERAGENT, "Dalvik/1.6.0 (Linux; U; Android 4.1.2; DROID RAZR HD Build/9.8.1Q-62_VQW_MR-2)");
        curl_setopt($ch, CURLOPT_REFERER, "-");
        $result = curl_exec($ch);
        curl_close($ch);
        $result = json_decode($result, true);
        $url = $result['item_list'][0]['video']['play_addr']['url_list'][0];
        $url = str_replace('playwm','play', $url);
        $ch = curl_init($url); //初始化
        curl_setopt($ch, CURLOPT_HEADER, 0); // 不返回header部分
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回字符串，而非直接输出
        curl_setopt($ch, CURLOPT_USERAGENT, "Dalvik/1.6.0 (Linux; U; Android 4.1.2; DROID RAZR HD Build/9.8.1Q-62_VQW_MR-2)");
        curl_setopt($ch, CURLOPT_REFERER, "-");
        $response = curl_exec($ch);
        curl_close($ch);
        $response = explode('"',$response);
        // 在页面上输出视频
        header('location:'.$response[1]);